<template>
    <div>
      <div class="container">
        <el-row>
          <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
            <div v-if="rzstatus=='未实名认证'">
              <el-alert type="warning">
                <div style="display:flex;flex-direction: row;">
                  <img src="../../../static/icon_tishi@2x.png" alt=""
                    style="width: 16px;height: 16px;text-align: center;margin-top: -1px;">
                  <div class="alert_text">您当前尚未实名认证，请进行实名认证，享受更多实名权益。 <a href="#" class="a_text" @click="goUrl('/detailInfoto','detailInfoto')">立即实名认证</a></div>
                </div>
              </el-alert>
            </div>
          </el-col>
        </el-row>
        <!-- 面包屑start -->
        <el-breadcrumb separator="/" class="breadCrumb_Box">
          <el-breadcrumb-item><a @click="goUrl('/enterprise', 'enterprise')">我的应用</a></el-breadcrumb-item>
          <el-breadcrumb-item>{{c_breadCrumb_name}}</el-breadcrumb-item>
        </el-breadcrumb>
        <!-- 面包屑end -->
        <el-row class="tac content">
          <el-col :xs="24" :sm="24" :md="24" :lg="4" :xl="4">
            <Navmenu @handleClick="handleClick"></Navmenu>
          </el-col>
  
          <el-col :xs="24" :sm="24" :md="24" :lg="20" :xl="20">
            <!-- <appList></appList> -->
            <div v-if="active==0">
              <upfileFirm isvip="0"></upfileFirm>
            </div>
            <div v-if="active==1">
              <appFirm></appFirm>
            </div>
          </el-col>
        </el-row>
      </div>
      <statement></statement>
    </div>
  </template>
  
  <script>
    import appFirm from "@/components/enterpriseMember/app";
    import upfileFirm from "@/components/enterpriseMember/upfileFirm";
    import Navmenu from '@/components/enterpriseMember/menu'
    import statement from "@/components/common/statement";
    import test from '../Yee/test.vue'
    export default {
      //import引入的组件需要注入到对象中才能使用
      components: {
        appFirm,
        Navmenu,
        statement,
        upfileFirm,
        test
      },
      data() {
        //这里存放数据
        return {
          c_breadCrumb_name: "应用列表",
          // 记录当前tab页
          active: 1,
          rzstatus: '', //实名状态
        };
      },
      //监听属性 类似于data概念
      computed: {},
      //监控data中的数据变化
      watch: {},
      //方法集合
      methods: {
        goUrl(path, name) {
          if (name == "enterprise") {
            location.reload();
          }
          this.$router.push({
            path: path,
            name: name,
          });
        },
        // 接收tab传回来的当前页  刷新存在问题 解决办法 存session 第一个页面为对应的组件 第二个类推 需要拆分出来
        handleClick(index) {
          this.active = index
          if (this.active == 0) {
            this.c_breadCrumb_name = "上传应用";
          } else {
            this.c_breadCrumb_name = "应用列表";
          }
        },
        getList() {
          this.$post(this.API.UserMsg).then((res) => {
            // console.log(res);
            let data = res.data;
            this.rzstatus = data.rzstatus;
            // console.log(this.rzstatus);
          })
        }
      },
      //生命周期 - 创建完成（可以访问当前this实例）
      created() {
        var token_time = sessionStorage["token_time"];
        token_time = parseInt(token_time);
        token_time = token_time + 3600000;
        var now = new Date().getTime();
        if (token_time < now || token_time == undefined || isNaN(token_time)) {
          console.log("未登录");
          this.hasLogin = false;
  
          //跳转到登录
          sessionStorage.setItem("currentTab_title", "");
          this.$router.push({
            path: "/login",
            name: "login",
          });
  
          return;
        }
  
        if (sessionStorage.getItem('setMenuIndex_firm') != null) {
          this.active = sessionStorage.getItem('setMenuIndex_firm')
          if (this.active == 0) {
            this.c_breadCrumb_name = "上传应用";
          } else {
            this.c_breadCrumb_name = "应用列表";
          }
        }
  
        this.getList();
  
  
      },
      //生命周期 - 挂载完成（可以访问DOM元素）
      mounted() {
  
        document.querySelector('body').setAttribute('style', 'background-color:#f7fafe');
      },
  
    }
  
  </script>
  <style scoped>
    /* 面包屑  */
    .breadCrumb_Box {
      margin-top: 30px;
    }
  
    .content {
      margin: 20px 0px 30px 0px;
      background: #FFFFFF;
      box-shadow: 0px 4px 10px 2px rgba(0, 0, 0, 0.08);
      border-radius: 4px;
      overflow: hidden;
    }
  
    div>>>.el-alert--warning.is-light {
      background-color: #FFF4E2;
      color: #C0A375;
    }
  
    .alert_text {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #C0A375;
      margin-top: -2px;
      margin-left: 5px;
    }
  
    .a_text {
      font-size: 14px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #71B7EC;
      margin-top: -2px;
    }
  
    a {
      text-decoration: none;
    }
    @media (max-width: 414px) {
      .alert_text {
      font-size: 12px;
      
    }
  
    .a_text {
      font-size: 12px;
    }
    }
  </style>
  